package com.qinghe.pro.service.apis.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qinghe.pro.entity.apis.Tmall;
import com.qinghe.pro.mapper.apis.TmallMapper;
import com.qinghe.pro.service.apis.TmallService;
import com.qinghe.utils.Page;

@Service("tmallServiceImpl")
public class TmallServiceImpl implements TmallService {

    @Autowired
    private TmallMapper tmallMapper;

	@Override
	public List<Tmall> findByPage(Tmall tmall, Page page) {
		PageHelper.startPage(page.getPageNum(), page.getNumPerPage()).setOrderBy("create_time desc");
		List<Tmall> list = tmallMapper.selectAll(tmall);
		PageInfo<Tmall> p = new PageInfo<Tmall>(list);
		page.setTotalCount((int) p.getTotal());
		return list;
	}

}
